﻿using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TSL_Tools.XMLTools;
using System.Xml;

namespace ReportingAppConfig
{
    public class CoreCounter
    {
        #region -- Public Properties ----------------------------------------------------
        public string counterName { get; private set; }
        public string category { get; private set; }
        public string counter { get; private set; }
        public string instance { get; private set; }
        public string machine { get; private set; }
        public string machineList { get; private set; }

        public string y_axisLabel { get; private set; }
        public int fixedScale { get; private set; }
        public string seriesType { get; private set; }
        public string lineColor { get; private set; }
        public int lineWidth { get; private set; }
        public bool showGoal { get; private set; }
        public double goal { get; private set; }
        public bool higherIsBetter { get; private set; }
        #endregion

        #region -- Private Properties ---------------------------------------------------
        #endregion

        #region -- Constructors ---------------------------------------------------------
        public CoreCounter() { }
        #endregion

        #region -- Public Methods -------------------------------------------------------
        /// <summary>
        /// Used to load the config user settings into the  <see cref="AppConfiguration"/> class settings
        /// </summary>
        public void GetConfigValues(XmlNode xChild)
        {
            counterName = XmlHelper.GetXmlAttributeValue(xChild, "Name", "");
            category = XmlHelper.GetXmlAttributeValue(xChild, "category", "");
            counter = XmlHelper.GetXmlAttributeValue(xChild, "counter", "");
            instance = XmlHelper.GetXmlAttributeValue(xChild, "instance", "");
            machine = XmlHelper.GetXmlAttributeValue(xChild, "machine", "");
            machineList = XmlHelper.GetXmlAttributeValue(xChild, "machineList", "");
            y_axisLabel = XmlHelper.GetXmlAttributeValue(xChild, "y_axisLabel", "");
            fixedScale = XmlHelper.GetXmlAttributeValue(xChild, "fixedScale", -1);
            seriesType = XmlHelper.GetXmlAttributeValue(xChild, "seriesType", "");
            lineColor = XmlHelper.GetXmlAttributeValue(xChild, "lineColor", "");
            lineWidth = XmlHelper.GetXmlAttributeValue(xChild, "lineWidth", 1);
            showGoal = XmlHelper.GetXmlAttributeValue(xChild, "showGoal", false);
            goal = XmlHelper.GetXmlAttributeValue(xChild, "goal", 0.0);
            higherIsBetter = XmlHelper.GetXmlAttributeValue(xChild, "higherIsBetter", true);
        }

        /// <summary>
        /// Used to set the <see cref="AppConfiguration"/> class settings back into the config user settings file and then to save them.
        /// </summary>
        public void SaveConfigValues(XmlDocument xDoc)
        {
        }

        #endregion

        #region -- Private Methods ------------------------------------------------------
        #endregion
    }
}
